<?
class Biz_Stats{

    //获得当前最新赛季
    function getLastSeason($force = false){
        $cache_key = "zc_last_season";
        if($force === true) $season = Lib_Cache::get($cache_key);
        if(!$season){
            $common = new Data_Common();
            $res = $common->getLastSeason();
            if(intval($res['result'][0]['season']) >0){
                $season = $res['result'][0]['season'];
                Lib_Cache::set($cache_key,$season);
            }
        }
        return $season;
    }

    //获得当前最新轮次
    function getLastRound2($season,$force = false){
        $cache_key	= 'ZC_LastRound2'.$season;
        if($force === true) $data = Lib_Cache::get($cache_key);
        if(!$data){
            $common = new Data_Common();
            $res = $common->getLastRound2($season);
//            print_z($res);
            if(intval($res['result'][0]['round']) >0){
                $data = $res['result'][0]['round'];
                Lib_Cache::set($cache_key,$data);
            }
        }
        return $data;
    }
    //获得当前最新轮次
    function getLastRound($season,$force = false){
        $cache_key	= 'ZC_LastRound'.$season;
        if($force === true) $data = Lib_Cache::get($cache_key);
        if(!$data){
            $common = new Data_Common();
            $res = $common->getLastRound($season);
            if(intval($res['result'][0]['round']) >0){
                $data = $res['result'][0]['round'];
                Lib_Cache::set($cache_key,$data);
            }
        }
        return $data;
    }
    //获得全部赛季列表
    function getSeasonArray(){
        $season = getLastSeason();
        $seasonArray = array();
        for($i=2004;$i<=$season;$i++){
            array_push($seasonArray,$i);
        }
        return $seasonArray;
    }
}
?>